Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

[E2E] Validation after admincli vmgroup and config ops #1568

Merged
merged 3 commits into from
Jul 11, 2017

Conversation

pshahzeb
Copy link
Contributor

This PR adds verification step in following 4 utils

CreateVMgroup()
DeleteVMgroup()
ConfigInit
ConfigRemove

The intention is to catch the regression early with such verification and avoid misleading during debugging as to which test failed and the reason for the same

Testing:
test-e2e passes

2017/07/10 19:31:23 END: VsanTestSuite.TestValidPolicy
2017/07/10 19:31:23 Destroying volume [vsanVol_volume_1060437@vsanDatastore]
2017/07/10 19:31:24 Removing policy [validPolicy] on esx [10.192.248.54]
OK: 34 passed
--- PASS: Test (1391.83s)
PASS
ok  	github.com/vmware/docker-volume-vsphere/tests/e2e	1391.836s
make: Leaving directory `/go/src/github.com/vmware/docker-volume-vsphere/client_plugin'

Fixes #1458

@pshahzeb pshahzeb changed the title Validation after admincli vmgroup and config ops [E2E] Validation after admincli vmgroup and config ops Jul 10, 2017
Copy link
Contributor

@lipingxue lipingxue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.

}

// Verify the vmgroup removal
if IsVmgroupPresent(ip, name) != true {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When "delete_vol" is set to true, should also check volume that associated with that vmgroup have been removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this util doesn't have knowledge about which volumes fall into the given VMgroup. So directly we cannot verify.
What we can do is retrieve the list of volumes from admin cli and in verification make sure those volumes are deleted. But I would prefer doing it out of this PR depending on the need of such verification.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, make sense.

}

// verify the DB init
if GetDBmode(ip) != admincli.DBSingleNode {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic seems not exactly consistent with what we are doing in above CreateVmGroup and DeleteVmGroup. If we follow the same style, the logic here should be something like this:

if GetDBmode(ip) == admincli.DBSingleNode {
    return out, nil
}

msg := ...
return msg, fmt.Errorf(msg)

Not a big concern, but I'd like to know if there are any specific reason for this difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No specific reason. Just happened to write the if condition in that way. Would you want it to be changed as per style in CreateVmGroup and DeleteVmGroup?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in CreateVmGroup and DeleteVmGroup makes more sense to me because we just want to add one extra verification, but don't really want to change the original successful command output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Will make it consistent.

}

// verify the DB removal
if GetDBmode(ip) != admincli.DBNotConfigured {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.


// verify the DB init
if GetDBmode(ip) == admincli.DBSingleNode {
return "DB init successful on esx " + ip, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we return original command output in this case?

return out, nil

Basically the point is: we don't want to change the original command output if the extra verification passes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


// verify the DB removal
if GetDBmode(ip) == admincli.DBNotConfigured {
return "DB remove successful on esx " + ip, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Contributor

@shaominchen shaominchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@pshahzeb pshahzeb merged commit 0d677c2 into vmware-archive:master Jul 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants